{include file="public/head"/}
<style>
    .main-content {
        margin-left: 0px;
        min-height: 80%;
    }

    .row .cf {
        margin-bottom: 10px;
    }

    .step-content {
        height: 560px;
    }

    .well {
        min-height: 90%;
    }

    .font-red {
        color: red;
        font-weight: bold;
    }
</style>


<div class="main-container" id="main-container">
    <script type="text/javascript">
        try {
            ace.settings.check('main-container', 'fixed')
        } catch (e) {
        }
    </script>

    <div class="main-container-inner">
        <a class="menu-toggler" id="menu-toggler" href="#">
            <span class="menu-text"></span>
        </a>
        {include file="public/nav"/}

        <div class="main-content">
            <div class="page-content">
                <div class="row">
                    <div class="well">
                        <h1 class=" lighter smaller">
              <span class="blue bigger-125">
                <i class="ace-icon fa fa-navicon"></i>
              </span>
                            完善工单 (<span class="font-red">{$work.car_num}</span>)
                            <a style="font-size:13px;" href="{:url('work/indexwork')}">返回列表</a>
                        </h1>
                        <hr>
                        <div class="space"></div>

                        <div class="row-fluid">
                            <div class="tabbable">
                                <ul class="nav nav-tabs" id="myTab">
                                    <li>
                                        <a data-toggle="tab" href="#basicWork">
                                            <i class="green fa fa-car bigger-110"></i>
                                            工单基本信息
                                        </a>
                                    </li>

                                    <li class="active">
                                        <a id="serversTab" data-toggle="tab" href="#servers">
                                            服务项目
                                        </a>
                                    </li>

                                    <li>
                                        <a id="checksTab" data-toggle="tab" href="#checks">
                                            检查项目
                                        </a>
                                    </li>

                                </ul>

                                <div class="tab-content">
                                    <div id="basicWork" class="tab-pane">
                                        <form class="form-horizontal" id="fmWork" method="post">
                                            <input type="hidden" name="id" value="{$work.id}">

                                            <div class="form-group">
                                                <label class="col-sm-3 control-label no-padding-right">日期</label>
                                                <div class="col-sm-9">
                                                    <input name="date" class="col-xs-10 col-sm-5" value="{$work.date}"
                                                           readonly>
                                                    <span class="help-inline col-xs-12 col-sm-7">
                            <span class="middle"></span>
                          </span>
                                                </div>
                                            </div>

                                            <div class="form-group">
                                                <label class="col-sm-3 control-label no-padding-right">工单号</label>
                                                <div class="col-sm-9">
                                                    <input name="num" class="col-xs-10 col-sm-5" value="{$work.num}"
                                                           readonly>
                                                    <span class="help-inline col-xs-12 col-sm-7">
                            <span class="middle"></span>
                          </span>
                                                </div>
                                            </div>

                                            <div class="form-group">
                                                <label class="col-sm-3 control-label no-padding-right">车牌号</label>
                                                <div class="col-sm-9">
                                                    <input readonly name="car_num" class="col-xs-10 col-sm-5"
                                                           value="{$work.car_num}">
                                                    <span class="help-inline col-xs-12 col-sm-7">
                            <span class="middle">
                              <!--<a href="#modal-tbCars" data-toggle="modal">选择/添加</a>&nbsp;&nbsp;-->
                            </span>
                          </span>
                                                </div>
                                            </div>

                                            <div class="form-group">
                                                <label class="col-sm-3 control-label no-padding-right">公里数</label>
                                                <div class="col-sm-9">
                                                    <input readonly name="mileage" class="col-xs-10 col-sm-5"
                                                           value="{$work.mileage}">
                                                    <span class="help-inline col-xs-12 col-sm-7">
                            <span class="middle">

                            </span>
                          </span>
                                                </div>
                                            </div>

                                            <div class="form-group">
                                                <label class="col-sm-3 control-label no-padding-right"> 接待 </label>
                                                <div class="col-sm-9">
                                                    {volist name="reception" id="r"}
                                                    <div class="radio">
                                                        <label>
                                                            <input disabled name="reception_id" type="radio" class="ace"
                                                                   value="{$r.id}" {if $work.reception_id==$r.id}
                                                                   checked {/if}>
                                                            <span class="lbl">{$r.name}</span>
                                                        </label>
                                                    </div>
                                                    {/volist}
                                                    <span class="help-inline col-xs-12 col-sm-7">
                            <span class="middle"></span>
                          </span>
                                                </div>
                                            </div>

                                            <div class="form-group">
                                                <label class="col-sm-3 control-label no-padding-right">客户</label>
                                                <div class="col-sm-9">
                                                    <input type="hidden" name="client_id" value="{$work.client_id}">
                                                    <input readonly name="client_name" class="col-xs-10 col-sm-5"
                                                           value="{$work.client_name}">
                                                </div>
                                            </div>
                                        </form>
                                        <hr>
                                    </div>

                                    <div id="servers" class="tab-pane active">
                                        <div class="row-fluid">
                                            <form class="form-horizontal" id="fmServer" method="post">
                                                <input type="hidden" name="id" value="{$work.id}">

                                                <div class="form-group">
                                                    <label class="col-sm-3 control-label no-padding-right">
                                                        维修技师 </label>
                                                    <div class="col-sm-9">
                                                        <div class="radio">
                                                            {volist name="repairmen" id="r"}
                                                            <label>
                                                                <input name="repairman_id" type="radio" class="ace"
                                                                       value="{$r.id}">
                                                                <span class="lbl">{$r.name}</span>
                                                            </label>&nbsp;&nbsp;
                                                            {/volist}
                                                        </div>
                                                        <span class="help-inline col-xs-12 col-sm-7">
                                  <span class="middle"></span>
                                </span>
                                                    </div>
                                                </div>

                                                <div class="form-group">
                                                    <label class="col-sm-3 control-label no-padding-right">服务项目</label>
                                                    <div class="col-sm-9">
                                <span class="help-inline col-xs-12 col-sm-7">
                                  <span class="middle">
                                    <a href="#modal-tbGood" data-toggle="modal">选择/添加</a>
                                  </span>
                                </span>
                                                    </div>
                                                </div>

                                                <div class="form-group">
                                                    <label class="col-sm-3 control-label no-padding-right">已选服务</label>
                                                    <div class="col-sm-5">
                                                        <table class="tbServerSelected tbServer table table-bordered table-striped col-sm-8">
                                                            <tr>
                                                                <td>编号</td>
                                                                <td>产品</td>
                                                                <td>价钱</td>
                                                                <td>数量</td>
                                                                <td>小计</td>
                                                            </tr>
                                                        </table>
                                                    </div>
                                                </div>
                                            </form>
                                            <hr>
                                            <div class="col-md-offset-3 col-md-9">
                                                <a class="btn btn-info submit" onclick="modifyWork.nextTab();"
                                                   data-loading-text="保存中...">
                                                    <i class="icon-ok bigger-110"></i>
                                                    下一步
                                                </a>
                                            </div>
                                            <div class="space-4"></div>
                                            <hr>
                                        </div>
                                    </div>

                                    <div id="checks" class="tab-pane">
                                        <form class="form-horizontal" id="fmCheck" method="post">
                                            {volist name="check" id="c"}
                                            <div class="form-group">
                                                <label class="col-sm-3 control-label no-padding-right">
                                                    {$c.name} </label>
                                                <div class="col-sm-9">
                                                    <div class="radio">
                                                        <label>
                                                            <input name="{$c.name}" type="radio" class="ace" value="OK"
                                                                   checked>
                                                            <span class="lbl">OK</span>
                                                        </label>&nbsp;&nbsp;
                                                        <label>
                                                            <input name="{$c.name}" type="radio" class="ace"
                                                                   value="已添加">
                                                            <span class="lbl">已添加</span>
                                                        </label>&nbsp;&nbsp;
                                                        <label>
                                                            <input name="{$c.name}" type="radio" class="ace"
                                                                   value="建议更换">
                                                            <span class="lbl">建议更换</span>
                                                        </label>
                                                    </div>
                                                    <span class="help-inline col-xs-12 col-sm-7">
                            <span class="middle"></span>
                          </span>
                                                </div>
                                            </div>
                                            {/volist}


                                            <div class="form-group">
                                                <label class="col-sm-3 control-label no-padding-right"> 服务建议 </label>
                                                <div class="col-sm-9">
                                                    <textarea name="propose"
                                                              class="col-xs-10 col-sm-8">车辆总体状态良好，请继续保持。</textarea>
                                                    <span class="help-inline col-xs-12 col-sm-7">
                            <span class="middle"></span>
                          </span>
                                                </div>
                                            </div>

                                            <div class="form-group">
                                                <label class="col-sm-3 control-label no-padding-right"> 保养建议 </label>
                                                <div class="col-sm-9">
                                                    <textarea name="care" class="col-xs-10 col-sm-8">建议下次保养在 {$nextDate} 或 {$work.mileage+5000} KM</textarea>
                                                    <span class="help-inline col-xs-12 col-sm-7">
                            <span class="middle"></span>
                          </span>
                                                </div>
                                            </div>

                                            <div class="form-group">
                                                <label class="col-sm-3 control-label no-padding-right"> 售后保单 </label>
                                                <div class="col-sm-9">
                                                    <textarea name="cover" class="col-xs-10 col-sm-8">本次为您服务的项目1质保期为______年/KM，项目2质保期为______年/KM，项目3质保期为______年/KM</textarea>
                                                    <span class="help-inline col-xs-12 col-sm-7">
                            <span class="middle"></span>
                          </span>
                                                </div>
                                            </div>
                                        </form>
                                        <hr>
                                        <div class="col-md-offset-3 col-md-9">
                                            <a class="btn btn-info submit" onclick="modifyWork.saveWork(this);"
                                               data-loading-text="保存中...">
                                                <i class="icon-ok bigger-110"></i>
                                                提交
                                            </a>
                                            <!-- <button class="btn" type="reset">
                                              <i class="icon-undo bigger-110"></i>
                                              重置
                                            </button> -->
                                        </div>
                                        <div class="space-4"></div>
                                        <hr>
                                    </div>
                                </div>


                                <!--选择客户模态框-->
                                <div id="modal-tbClients" class="modal" tabindex="-1">
                                    <div class="modal-dialog modal-lg">
                                        <div class="modal-content">
                                            <div class="modal-header">
                                                <button class="close" data-dismiss="modal">&times;</button>
                                                <h4 class="blue bigger">选择客户</h4>
                                            </div>
                                            <div class="modal-body overflow-visible">
                                                <!--客户添加表单-->
                                                <form class="form-inline fmClientAdd-hook">
                                                    <input class="input-small" name="name" placeholder="客户姓名"/>
                                                    <input class="input-small" name="address" placeholder="地址"/>
                                                    <input class="input-small" name="phone" placeholder="电话"/>
                                                    <button type="button" class="btn btn-info btn-sm"
                                                            onclick="modifyWork.addClient();">
                                                        <i class="fa fa-plus bigger-110"></i>
                                                        添加
                                                    </button>
                                                    <button type="reset" class="btn btn-primary btn-sm">
                                                        <i class="fa fa-reply bigger-110"></i>
                                                        重置
                                                    </button>
                                                </form>
                                                <!--数据筛选表单-->
                                                <form class="form-inline fmClientQuery-hook">
                                                    <input class="input-small" name="name" placeholder="客户姓名"/>
                                                    <input class="input-small" name="address" placeholder="地址"/>
                                                    <input class="input-small" name="phone" placeholder="电话"/>
                                                    <button type="button" class="btn btn-info btn-sm"
                                                            onclick="modifyWork.search();">
                                                        <i class="fa fa-search bigger-110"></i>
                                                        查找
                                                    </button>
                                                    <button type="button" class="btn btn-primary btn-sm"
                                                            onclick="modifyWork.searchNull();">
                                                        <i class="fa fa-remove bigger-110"></i>
                                                        清空
                                                    </button>
                                                </form>
                                                <!--客户数据表-->
                                                <table id="tbClients"></table>
                                                <!--客户表页码内容-->
                                                <div id="tbClientsPager"></div>
                                            </div>
                                            <div class="modal-footer">
                                                <button class="btn btn-sm" data-dismiss="modal">
                                                    <i class="icon-remove"></i>
                                                    取消
                                                </button>
                                                <!--<button class="btn btn-sm btn-primary">
                                                  <i class="icon-ok"></i>
                                                  保存
                                                </button>-->
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <!--选择产品模态框-->
                                <div id="modal-tbGood" class="modal" tabindex="-1">
                                    <div class="modal-dialog modal-lg">
                                        <div class="modal-content">
                                            <div class="modal-header">
                                                <button class="close" data-dismiss="modal">&times;</button>
                                                <h4 class="blue bigger">选择产品</h4>
                                            </div>
                                            <div class="modal-body overflow-visible">
                                                <!--数据筛选表单-->
                                                <form class="form-inline fmGoodQuery-hook">
                                                    <input class="input-small" name="num" placeholder="编号"/>
                                                    <input class="input-small" name="name" placeholder="名称"/>
                                                    <input class="input-small" name="price" placeholder="单价"/>
                                                    <button type="button" class="btn btn-info btn-sm"
                                                            onclick="addCarSingleForm.searchGood();">
                                                        <i class="fa fa-search bigger-110"></i>
                                                        查找
                                                    </button>
                                                    <button type="button" class="btn btn-primary btn-sm"
                                                            onclick="addCarSingleForm.searchNullGood();">
                                                        <i class="fa fa-remove bigger-110"></i>
                                                        清空
                                                    </button>
                                                </form>
                                                <!--客户数据表-->
                                                <table id="tbGood"></table>
                                                <!--客户表页码内容-->
                                                <div id="tbGoodPager"></div>

                                                <!--以选中的-->
                                                <table class="tbServerSelected table table-bordered table-striped">
                                                    <tr>
                                                        <td>编号</td>
                                                        <td>产品</td>
                                                        <td>单价</td>
                                                        <td>数量</td>
                                                        <td>小计</td>
                                                    </tr>
                                                </table>
                                            </div>
                                            <div class="modal-footer">
                                                <button class="btn btn-sm" data-dismiss="modal">
                                                    <i class="icon-remove"></i>
                                                    取消
                                                </button>
                                                <button class="btn btn-sm btn-primary"
                                                        onclick="addCarSingleForm.confirmServe();">
                                                    <i class="icon-ok"></i>
                                                    确定
                                                </button>
                                            </div>
                                        </div>
                                    </div>
                                </div>

                                <div class="space-6"></div>

                            </div>
                        </div>
                    </div>
                    <!-- /.row -->
                </div>
                <!-- /.page-content -->
            </div>
            <!-- /.main-content -->

        </div>
        <!-- /.main-container-inner -->

        <a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse">
            <i class="icon-double-angle-up icon-only bigger-110"></i>
        </a>
    </div>
</div>
<!-- /.main-container -->
{include file="public/footerjs"/}
<script type="text/javascript">
    modifyWork_urls = {
        modifyWork: '{:url("work/doModifyWork")}',
        indexInvoice: "{:url('invoice/indexinvoice')}",
        doRecharge: '{:url("work/doRecharge")}',
        getClients: "{:url('client/getClients')}",
        mainPage: "{:url('main/modulefront')}",
    };
    var addCarSingleForm_urls = {
        getWork: "{:url('work/getWork')}",
        getGood: "{:url('good/getGood')}",
        addGood: '{:url("good/doAdd")}',
        addWork: '{:url("work/doAddTech")}',
        indexServer: "{:url('server/indexserver')}",
    }
</script>
<script src="__ADMIN__/js/car/addcarsingleform.js"></script>
<script src="__ADMIN__/js/work/modifywork.js"></script>
{include file="public/foot"/}